[Linux] linux 下used显示使用的内存过大,但实际进程占用的内存很小


本文总阅读量

1、查看当前系统内存的使用情况:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
[root@zabbix-zyl gopmonitor]# top|head -10
top - 10:25:34 up 90 days, 1:31, 4 users, load average: 0.65, 0.58, 0.37
Tasks: 1027 total, 1 running, 1025 sleeping, 0 stopped, 1 zombie
Cpu(s): 0.8%us, 0.5%sy, 0.0%ni, 97.6%id, 1.2%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 16318608k total, 15056496k used, 1262112k free, 202316k buffers
Swap: 10485756k total, 3422652k used, 7063104k free, 364088k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
116159 root 20 0 15700 1868 832 R 3.8 0.0 0:00.03 top
3901 zabbix 20 0 3699m 5800 3432 S 1.9 0.0 0:14.09 zabbix_server
1 root 20 0 19356 848 628 S 0.0 0.0 0:07.99 init
[root@zabbix-zyl gopmonitor]# free -m
total used free shared buffers cached
Mem: 15936 14704 1231 2 197 355
-/+ buffers/cache: 14151 1785
Swap: 10239 3342 6897

2、释放所有缓存再次查看,缓存释放掉了:

1
2
3
4
5
6
[root@zabbix-zyl gopmonitor]# echo 3 > /proc/sys/vm/drop_caches
[root@zabbix-zyl gopmonitor]# free -m
total used free shared buffers cached
Mem: 15936 4141 11794 2 8 47
-/+ buffers/cache: 4086 11849
Swap: 10239 3342 6897

3、关于/proc/sys/vm/drop_caches参数不同值对应的含义:

1
2
3
4
0:不释放(系统默认值)
1:释放页缓存
2:释放dentries和inodes
3:释放所有缓存( 不是破坏性操作,脏的对象(比如脏页)不会被释放,可以运行sync命令,使用sync命令强制缓冲区的所有数据写入磁盘。)
目录
  1. 1. 1、查看当前系统内存的使用情况:
  2. 2. 2、释放所有缓存再次查看,缓存释放掉了:
  3. 3. 3、关于/proc/sys/vm/drop_caches参数不同值对应的含义:

Proudly powered by Hexo and Theme by Lap
本站访客数人次
© 2020 zeven0707's blog